home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
turbotut.arc
/
LOOPDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-06-30
|
741b
|
37 lines
PROGRAM demonstrate_loops;
VAR count : INTEGER;
start : INTEGER;
ending : INTEGER;
total : INTEGER;
alphabet : CHAR;
BEGIN
start := 1;
ending := 7;
FOR count := start TO ending DO (* Example 1 *)
WRITELN('This is a count loop and we are in pass',count:4);
total := 0;
FOR count := 1 TO 10 DO (* Example 2 *)
BEGIN
total := total + 12;
WRITE('count =',count:3,' total =',total:5);
WRITELN;
END;
WRITELN;
WRITE('The alphabet is ');
FOR alphabet := 'A' TO 'Z' DO (* Example 3 *)
WRITE(alphabet);
WRITELN;
FOR count := 7 DOWNTO 2 DO (* Example 4 *)
WRITELN('Decrementing loop ',count:3);
END.